﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using System.Threading;

namespace CSF.WinApp.JobNotifier
{
    static class Program
    {
        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            bool initiallyOwned = true;
            bool isCreated;
            Mutex m = new Mutex(initiallyOwned, "MyTest", out isCreated);
            if (!(initiallyOwned && isCreated))
            {
                MessageBox.Show("已经有相同的实例在运行。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                Application.Exit();
            }
            else
            {
                Login login = new Login();
                if (login.ShowDialog() == DialogResult.OK)
                {
                    Application.Run(new Main());
                }
            }
        }
    }
}
